# -*- coding: utf-8 -*-
"""
Created on Sat May 11 17:26:46 2019

@author: yaoyu
"""

import pandas as pd
import numpy as np

b = pd.DataFrame(np.arange(20).reshape(4,5), index=['c','a','d','b'])
print(b,'\n')
print(b.sort_index(),'\n')
print(b.sort_index(ascending=False),'\n')

print(b.sort_values(2))

print(b.sum())
print(b.describe(),'\n')

a = pd.Series([9,8,7,6], index=['a','b','c','d'])
print(a.describe(), '\n')

hprice = pd.Series([3.04, 22.93, 12.75, 22.6, 12.33],
                   index=['2008','2009','2010','2011','2012'])
m2 = pd.Series([8.18, 18.38, 9.13, 7.82, 6.69],
               index=['2008','2009','2010','2011','2012'])

print(hprice.corr(m2))